#include <stdio.h>

#include "SupplyBag.h"
#include "include.h"

SupplyBag::SupplyBag()
{
	maxGrenades = 3;
	grenades = 0;
}
SupplyBag::SupplyBag(int maxGrenades)
{
	this->maxGrenades = maxGrenades;
	grenades = 0;
}

void SupplyBag::SetGrenades(int grenades)
{
	this->grenades = grenades;
	if(grenades > maxGrenades)
		this->grenades = maxGrenades;
}
int SupplyBag::GetGrenades()
{
	return grenades;
}
bool SupplyBag::AddGrenade()
{
	printf("Adding Grenade\n");
	if(grenades < maxGrenades)
	{
		grenades++;
		printf("grenades = %d\n", grenades);
		return true;
	}
	return false;
}
bool SupplyBag::RemoveGrenade()
{
	if(grenades > 0 )
	{
		grenades--;
		return true;
	}
	return false;
}
bool SupplyBag::HandleId(int supplyId)
{
	switch(supplyId)
	{
		case GRENADE_PICKUP_TYPE:
			return AddGrenade();
		break;
		case DEFAULT_SPRITE_TYPE:
		default:
			break;
	}
	return true;
}

		